<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
    <script>
       //注册事件监听
       function connectWebViewJavascriptBridge(callback) {
           if (window.WebViewJavascriptBridge) {
               WebViewJavascriptBridge.init();
               callback(WebViewJavascriptBridge)
           } else {
               document.addEventListener(
                   'WebViewJavascriptBridgeReady'
                   , function() {
                       WebViewJavascriptBridge.init();
                       callback(WebViewJavascriptBridge)
                   },
                   false
               );
           }
       }
       //注册回调函数，第一次连接时调用 初始化函数
       connectWebViewJavascriptBridge(function(bridge) {
           bridge.registerHandler("jsFunction", function(data, responseCallback) {
                 document.getElementById("content").innerHTML = ("data from Java: = " + data);
                 var responseData = "Javascript Says Right back aka!";
                 responseCallback(responseData);
           });
       })
    </script>
</head>
<body>

<div>
    <button id="btn0">调用nativeMethod无参方法</button>
</div>

<div>
    <button id="btn1">调用nativeMethod有参方法</button>
</div>

<div>
    <button id="btn2">获取EditText文字内容</button>
</div>

<div>
    <button id="btn_jump">js跳转原生界面</button>
</div>

<div>
    <button id="js_bridge_btn">bridge调用原生方法</button>
</div>

<div>
    <a href='reone://app/second'>连接跳转原生界面</a>
</div>

<div>
    <a href='https://www.baidu.com'>百度</a>
</div>

<div id="content">

</div>

</body>

<script type="text/javascript">
        var content = document.getElementById("content");
        var name = "1234567890-="
        document.getElementById("btn0").onclick = function(){
            nativeMethod.show();
        };
        document.getElementById("btn1").onclick = function(){
              nativeMethod.show(name);
        };
        document.getElementById("btn2").onclick = function(){
              content.innerHTML = "editText:" + MainActivity.getText();
        };
        document.getElementById("btn_jump").onclick = function(){
              window.location.href=MainActivity.getJumpUrl()
        };

        document.getElementById("js_bridge_btn").onclick = function(){
            window.WebViewJavascriptBridge.callHandler(
               'showJsBridge'
               ,"js_bridge_btn param"
               , function(responseData) {
                    content.innerHTML = ("data from Java: = " + responseData);
               }
           );
        };

        function message(){
            content.innerHTML = "调用了无参的js函数";
        };

        function message2(des){
            content.innerHTML = "调用了有参的js函数,参数"+des;
        };
    </script>
</html>